package com.xymtop.sqlcater.core.sql.sqlexecute.select.entity;


import lombok.Data;

//查询时的having
@Data
public class Having {

    //对应的构造条件
    private SqlSelectField sqlSelectField1;


    private SqlSelectField sqlSelectField2;


    public String getBuildSql(){
        String res = "";
        if(sqlSelectField1!=null&&sqlSelectField2!=null){
            res += "HAVING ";
            String sql1 = sqlSelectField1.getAsName()==null?sqlSelectField1.getName():sqlSelectField1.getAsName();
            String sql2 = sqlSelectField2.getAsName()==null?sqlSelectField2.getName():sqlSelectField2.getAsName();
            res += sql1 + "="+ sql2;
        }
        res += " ";
        return res;
    }
}
